<template>
  <backContainer>
    <card
      v-loading="loading"
      :width="1400"
      class="box"
      style="margin: 24px auto 0 auto; padding-top: 20px"
    >
      <!-- 列表 -->

      <div class="flexBet" style="width: 100%">
        <div class="title_use">待审核课程</div>
      </div>
      <div class="list flex">
        <div class="flex" v-if="temporaryList.length > 0">
          <courseItem
            class="courseItem"
            v-for="(item, index) in temporaryList"
            :key="index"
            :item="item"
          ></courseItem>
        </div>
        <div
          v-else
          style="
            margin-bottom: 37px;
            width: 100%;
            height: 200px;
            transform: scale(0.8);
            display: flex;
            justify-content: center;
          "
        >
          <el-empty description="暂无待审核课程~" style=""></el-empty>
        </div>
      </div>
    </card>
  </backContainer>
</template>

<script>
import courseItem from '@/components/courseItem.vue'
import { waitReviewCourseList } from '@/api/disciplineGroup/disciplineGroup'

export default {
  components: { courseItem },
  data() {
    return {
      loading: false,
      temporaryList: []
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    // 获取列表
    async getList() {
      try {
        this.loading = true
        let res = await waitReviewCourseList()
        if (res.code == 200) {
          res.data.map((item) => {
            item.principalId = this.$store.getters.teacherId
            item.temporaryState = 3
            item.status = 6
          })
          this.temporaryList = res.data
        }
      } finally {
        this.loading = false
      }
    }
  }
}
</script>

<style scoped lang="scss">
.list {
  flex-direction: row;
  align-items: flex-start;
  flex-wrap: wrap;
  box-sizing: border-box;
  overflow: auto;
  height: calc(100vh - 220px);

  .courseItem:nth-of-type(5n + 1) {
    margin-left: 40px;
  }
}

.title_use {
  padding-left: 40px;
  font-size: 18px;
  font-family: PingFangSC-Semibold, PingFang SC, sans-serif;
  font-weight: 600;
  color: #3a3a3a;
  width: 100%;
  margin: 20px 0;
}
</style>
